//
//  ZDBRechargeView.m
//  ZDB
//
//  Created by Kk on 2020/4/1.
//  Copyright © 2020 ZDB. All rights reserved.
//

#import "ZDBRechargeView.h"
#import "ZDBRechargeCell.h"
@implementation ZDBRechargeView


-(void)awakeFromNib{
    [super awakeFromNib];
   
    [self initView1];
    [self initView2];
    [self initView3];
    [self initView4];
    [self initView5];
}
- (void)initView1
{
    
}
- (void)initView2
{
    KViewRadius(_subimtBtn, _subimtBtn.height/2);
}
- (void)initView3
{
    
}
- (void)initView4
{
     _tableView.tableFooterView = [UIView new];
     _tableView.separatorColor = CLEARCOLOR;
     _tableView.delegate = self;
     _tableView.dataSource=self;
     _tableView.backgroundColor =  WHITECOLOR;
     _tableView.showsVerticalScrollIndicator = NO;
     [_tableView registerNib:[UINib nibWithNibName:@"ZDBRechargeCell" bundle:nil]  forCellReuseIdentifier:@"ZDBRechargeCell"];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _dataArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    ZDBRechargeCell *cell = [_tableView dequeueReusableCellWithIdentifier:@"ZDBRechargeCell" forIndexPath:indexPath];
    cell.model = _dataArray[indexPath.row];
    return cell;
}
- (void)reloadData:(NSMutableArray *)dataArray;
{
    _dataArray = dataArray;
    [self.tableView reloadData];
    dispatch_async(dispatch_get_main_queue(), ^{
        [self placeholderViewWithFrame:self.tableView.frame NoNetwork:NO];
    });
}
- (void)placeholderViewWithFrame:(CGRect)frame NoNetwork:(BOOL)NoNetwork
{
    if (self.dataArray.count == 0)
    {
        [_workView removeFromSuperview];
        _workView = [[NoNetworkView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height) NoNetwork:NoNetwork];
        [self.tableView addSubview:_workView];
        //_workView.centerY = self.collectionView.centerY-100;
    }else
    {
        [_workView dissmiss];
    }
    
}
- (void)initView5
{
    
}

@end
